Caption = "Changing Width Value Using Explicit Refresh."
Height = 375
Left = 240
TabIndex = 5
Top = 2640
Width = 2175
End
Begin Label Label1
BackColor = &H00808000&
Caption = "Changing Width Value With VB's Idle Refresh."
Height = 375
Left = 240
TabIndex = 4
Top = 1320
Width = 2175
End
Begin Label Label3
BackColor = &H00808000&
Caption = "Width ="
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 12
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 375
Left = 2880
TabIndex = 6
Top = 360
Width = 975
End
Begin Menu mnuHelp
Caption = "&Help"
Begin Menu mnuNotes
Caption = "&Notes..."
End
Begin Menu mnuAbout
Caption = "&About..."
End
End
End
Const ttlHelpAbout$ = "Who Done It?"
Const msgHelpAbout$ = "Just for fun - Peter Hartquist 73227,3600"
Const ttlHelpNotes$ = "What Does It Do?"
Const msgHelpNotes$ = "According the the Language Reference manual, refreshing a form or control happens automatically when VB's idle loop is reached. This demo shows the effect of explicitly using Refresh on a dynamically changing control."
'
' According the the Visual Basic Language Reference manual, refreshing
' a form or control happens automatically when VB's idle loop is reached.
' In this example I have created a situation to demonstrate
' the effects of using or not using Refesh on a control
' (a text box) while it repetitively changes in width.
'
' I have created two similar controls on the form. One text box changes
' without using Refresh and one changes with Refresh on each change.
'
' It looks like Refresh is not necessary when decreasing the width of a
' text box control. It actually causes jitter in the redrawn image.
' But Refresh is needed to see the effects of repetitively increasing
' the width of the text box. Without Refresh, the text box doesn't
' display with its' correct width until the repetitive changes have
' all been completed.
'
'
Sub cmbDemo_Click ()
cmbDemo.Enabled = False
txbNonRefComment.Text = "Smooth" 'Comments while
txbRefComment.Text = "Jitters a bit" 'Width decreases
For I = -4500 To 4500 Step 50 'Initial Textbox Width = 4500
If Abs(I) < 250 Then 'Handle low wdith value
I = 250 'Avoid low or zero I value
txbNonRefComment.Text = "Wrong Width" 'Comments while